home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / POPDIR.DMO < prev    next >
Text File  |  1988-12-18  |  772b  |  30 lines

  1. #include <pushpop.h>
  2.  
  3.   int whandle,wread;
  4.   char wpath[STKRECSIZE];
  5.   char wpathfromroot[STKRECSIZE+1];    /* '\\' + wpath */
  6.   long fsize,jzsekfil();
  7. main()
  8. {
  9.  
  10.   if ((whandle = jzopnfil(FNAME,2)) != -1) {
  11.     fsize = jzsekfil(whandle,0L,2);          /* seek to end of file */
  12.     if (fsize) {
  13.       fsize -= (long) STKRECSIZE;
  14.       jzsekfil(whandle,fsize,0);        /* seek to eof - 1 record */
  15.       jzredfil(whandle,wpath,STKRECSIZE);
  16.       strcpy(wpathfromroot,"\\");               /* start from root dir */
  17.       strcat(wpathfromroot,wpath);        /* add full path */
  18.       chdir(wpathfromroot);
  19.       chsize(whandle,fsize);            /* "pop" file (truncate) */
  20.       jzclsfil(whandle);
  21.       exit(0);
  22.     }
  23.     else
  24.       exit(1);
  25.   }
  26.   else
  27.     exit(1);
  28. }
  29.  
  30.